﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace 路由事件.Tools
{
    public class SalesManager
    {
        public static readonly RoutedEvent CheckEvent = EventManager.RegisterRoutedEvent(
            "CheckEvent",
            RoutingStrategy.Bubble,
            typeof(RoutedEventHandler),
            typeof(SalesManager));

        public static void AddCheckHandler(DependencyObject dependencyObject, RoutedEventHandler handler)
        {
            if (dependencyObject is UIElement uiElement)
            {
                uiElement.AddHandler(CheckEvent, handler);
            }
        }

        public static void RemoveCheckHandler(DependencyObject dependencyObject, RoutedEventHandler handler)
        {
            if (dependencyObject is UIElement uiElement)
            {
                uiElement.RemoveHandler(CheckEvent, handler);
            }
        }
    }
}
